home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Tool Chest / QuickDraw / Virtual Sphere 1.0.1 / Virtual Sphere Sample Code 1.1 / Sample.r < prev    next >
Encoding:
Text File  |  1993-03-25  |  9.9 KB  |  481 lines  |  [TEXT/MPS ]

  1. /*•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  2. /* Sample.r
  3. /*
  4. /* Modified for Virtual Sphere Sample Code Release v1.1
  5. /*
  6. /* Author: Michael Chen, Human Interface Group / ATG
  7. /* Copyright © 1991-1993 Apple Computer, Inc.  All rights reserved.
  8. /*•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
  9. /*------------------------------------------------------------------------------
  10. #
  11. #    Apple Macintosh Developer Technical Support
  12. #
  13. #    MultiFinder-Aware Simple Sample Application
  14. #
  15. #    Sample
  16. #
  17. #    Sample.r    -    Rez Source
  18. #
  19. #    Copyright © Apple Computer, Inc. 1989-1990
  20. #    All rights reserved.
  21. #
  22. #    Versions:    
  23. #                1.00                08/88
  24. #                1.01                11/88
  25. #                1.02                04/89    MPW 3.1
  26. #                1.03                02/90    MPW 3.2
  27. #
  28. #    Components:
  29. #                Sample.c            Feb.  1, 1990
  30. #                Sample.r            Feb.  1, 1990
  31. #                Sample.h            Feb.  1, 1990
  32. #                Sample.make            Feb.  1, 1990
  33. #
  34. #    Sample is an example application that demonstrates how to
  35. #    initialize the commonly used toolbox managers, operate 
  36. #    successfully under MultiFinder, handle desk accessories, 
  37. #    and create, grow, and zoom windows.
  38. #
  39. #    It does not by any means demonstrate all the techniques 
  40. #    you need for a large application. In particular, Sample 
  41. #    does not cover exception handling, multiple windows/documents, 
  42. #    sophisticated memory management, printing, or undo. All of 
  43. #    these are vital parts of a normal full-sized application.
  44. #
  45. #    This application is an example of the form of a Macintosh 
  46. #    application; it is NOT a template. It is NOT intended to be 
  47. #    used as a foundation for the next world-class, best-selling, 
  48. #    600K application. A stick figure drawing of the human body may 
  49. #    be a good example of the form for a painting, but that does not 
  50. #    mean it should be used as the basis for the next Mona Lisa.
  51. #
  52. #    We recommend that you review this program or TESample before 
  53. #    beginning a new application.
  54. ------------------------------------------------------------------------------*/
  55.  
  56.  
  57. #include "SysTypes.r"
  58. #include "Types.r"
  59.  
  60. #include "Sample.h"
  61.  
  62. resource 'vers' (1) {
  63.     0x01, 0x00, beta, 0x00,
  64.     verUS,
  65.     "1.1",
  66.     "1.1, \251 Apple Computer, Inc. 1987-1993.  All Rights Reserved."
  67. };
  68.  
  69.  
  70. /* we use an MBAR resource to conveniently load all the menus */
  71.  
  72. resource 'MBAR' (rMenuBar, preload) {
  73.     { mApple, mFile, mEdit, mObject, mOptions };
  74. };
  75.  
  76.  
  77. resource 'MENU' (mApple, preload) {
  78.     mApple, textMenuProc,
  79.     AllItems & ~MenuItem2,    /* Disable dashed line, enable About and DAs */
  80.     enabled, apple,
  81.     {
  82.         "About Virtual Sphere Sample…",
  83.             noicon, nokey, nomark, plain;
  84.         "-",
  85.             noicon, nokey, nomark, plain
  86.     }
  87. };
  88.  
  89. resource 'MENU' (mFile, preload) {
  90.     mFile, textMenuProc,
  91.     MenuItem12,                /* enable Quit only, program enables others */
  92.     enabled, "File",
  93.     {
  94.         "New",
  95.             noicon, "N", nomark, plain;
  96.         "Open",
  97.             noicon, "O", nomark, plain;
  98.         "-",
  99.             noicon, nokey, nomark, plain;
  100.         "Close",
  101.             noicon, "W", nomark, plain;
  102.         "Save",
  103.             noicon, "S", nomark, plain;
  104.         "Save As…",
  105.             noicon, nokey, nomark, plain;
  106.         "Revert",
  107.             noicon, nokey, nomark, plain;
  108.         "-",
  109.             noicon, nokey, nomark, plain;
  110.         "Page Setup…",
  111.             noicon, nokey, nomark, plain;
  112.         "Print…",
  113.             noicon, nokey, nomark, plain;
  114.         "-",
  115.             noicon, nokey, nomark, plain;
  116.         "Quit",
  117.             noicon, "Q", nomark, plain
  118.     }
  119. };
  120.  
  121. resource 'MENU' (mEdit, preload) {
  122.     mEdit, textMenuProc,
  123.     NoItems,                /* disable everything, program does the enabling */
  124.     enabled, "Edit",
  125.      {
  126.         "Undo",
  127.             noicon, "Z", nomark, plain;
  128.         "-",
  129.             noicon, nokey, nomark, plain;
  130.         "Cut",
  131.             noicon, "X", nomark, plain;
  132.         "Copy",
  133.             noicon, "C", nomark, plain;
  134.         "Paste",
  135.             noicon, "V", nomark, plain;
  136.         "Clear",
  137.             noicon, nokey, nomark, plain
  138.     }
  139. };
  140.  
  141. resource 'MENU' (mObject, preload) {
  142.     mObject, textMenuProc,
  143.     NoItems,                /* disable everything, program does the enabling */
  144.     enabled, "Object",
  145.      {
  146.         "Cube",
  147.             noicon, nokey, nomark, plain;
  148.         "Icosahedron",
  149.             noicon, nokey, nomark, plain;
  150.         "House",
  151.             noicon, nokey, nomark, plain;
  152.     }
  153. };
  154.  
  155.  
  156. resource 'MENU' (mOptions, preload) {
  157.     mOptions, textMenuProc,
  158.     NoItems,                /* disable everything, program does the enabling */
  159.     enabled, "Options",
  160.      {
  161.         "Line Drawing",
  162.             noicon, nokey, nomark, plain;
  163.         "Flat Shading",
  164.             noicon, nokey, nomark, plain;
  165.         "Flat Shading with Outline",
  166.             noicon, nokey, nomark, plain;
  167.         "-",
  168.             noicon, nokey, nomark, plain;
  169.         "Draw In B/W",
  170.             noicon, nokey, nomark, plain;
  171.         "Draw In Color",
  172.             noicon, nokey, nomark, plain;
  173.         "-",
  174.             noicon, nokey, nomark, plain;
  175.         "Backfaced Polygon Removal",
  176.             noicon, nokey, nomark, plain;
  177.         "Double Buffer",
  178.             noicon, nokey, nomark, plain;
  179.     }
  180. };
  181.  
  182.  
  183. /* this ALRT and DITL are used as an About screen */
  184.  
  185. resource 'ALRT' (rAboutAlert, purgeable) {
  186.     {40, 20, 160, 297},
  187.     rAboutAlert,
  188.     { /* array: 4 elements */
  189.         /* [1] */
  190.         OK, visible, silent,
  191.         /* [2] */
  192.         OK, visible, silent,
  193.         /* [3] */
  194.         OK, visible, silent,
  195.         /* [4] */
  196.         OK, visible, silent
  197.     }
  198. };
  199.  
  200. resource 'DITL' (rAboutAlert, purgeable) {
  201.     { /* array DITLarray: 5 elements */
  202.         /* [1] */
  203.         {88, 185, 108, 265},
  204.         Button {
  205.             enabled,
  206.             "OK"
  207.         },
  208.         /* [2] */
  209.         {8, 8, 24, 214},
  210.         StaticText {
  211.             disabled,
  212.             "Virtual Sphere Sample v1.1"
  213.         },
  214.         /* [3] */
  215.         {32, 8, 48, 296},
  216.         StaticText {
  217.             disabled,
  218.             "Copyright © Apple Computer Inc. 1993."
  219.         },
  220.         /* [4] */
  221.         {56, 8, 72, 136},
  222.         StaticText {
  223.             disabled,
  224.             "Brought to you by:"
  225.         },
  226.         /* [5] */
  227.         {80, 24, 112, 167},
  228.         StaticText {
  229.             disabled,
  230.             "Michael Chen, Human Interface Group / ATG"
  231.         }
  232.     }
  233. };
  234.  
  235.  
  236. /* this ALRT and DITL are used as an error screen */
  237.  
  238. resource 'ALRT' (rUserAlert, purgeable) {
  239.     {40, 20, 120, 260},
  240.     rUserAlert,
  241.     { /* array: 4 elements */
  242.         /* [1] */
  243.         OK, visible, silent,
  244.         /* [2] */
  245.         OK, visible, silent,
  246.         /* [3] */
  247.         OK, visible, silent,
  248.         /* [4] */
  249.         OK, visible, silent
  250.     }
  251. };
  252.  
  253. resource 'ALRT' (130, purgeable) {
  254.     {40, 20, 154, 260},
  255.     130,
  256.     {    /* array: 4 elements */
  257.         /* [1] */
  258.         OK, visible, silent,
  259.         /* [2] */
  260.         OK, visible, silent,
  261.         /* [3] */
  262.         OK, visible, silent,
  263.         /* [4] */
  264.         OK, visible, silent
  265.     }
  266. };
  267.  
  268. resource 'DITL' (rUserAlert, purgeable) {
  269.     { /* array DITLarray: 3 elements */
  270.         /* [1] */
  271.         {50, 150, 70, 230},
  272.         Button {
  273.             enabled,
  274.             "OK"
  275.         },
  276.         /* [2] */
  277.         {10, 60, 30, 230},
  278.         StaticText {
  279.             disabled,
  280.             "Sample - Error occurred!"
  281.         },
  282.         /* [3] */
  283.         {8, 8, 40, 40},
  284.         Icon {
  285.             disabled,
  286.             2
  287.         }
  288.     }
  289. };
  290.  
  291. resource 'DITL' (rMessageAlert, purgeable) {
  292.     {    /* array DITLarray: 3 elements */
  293.         /* [1] */
  294.         {87, 150, 107, 230},
  295.         Button {
  296.             enabled,
  297.             "OK"
  298.         },
  299.         /* [2] */
  300.         {10, 60, 72, 230},
  301.         StaticText {
  302.             disabled,
  303.             "^0"
  304.         },
  305.         /* [3] */
  306.         {8, 8, 40, 40},
  307.         Icon {
  308.             disabled,
  309.             2
  310.         }
  311.     }
  312. };
  313.  
  314.  
  315. resource 'WIND' (rWindow, preload, purgeable) {
  316.     {60, 60, 60+300, 60+300},
  317.     noGrowDocProc, visible, noGoAway, 0x0, "Virtual Sphere"
  318. };
  319.  
  320.  
  321. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  322.  
  323. resource 'SIZE' (-1) {
  324.     dontSaveScreen,
  325.     acceptSuspendResumeEvents,
  326.     enableOptionSwitch,
  327.     canBackground,                /* we can background; we don't currently, but our sleep value */
  328.                                 /* guarantees we don't hog the Mac while we are in the background */
  329.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  330.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  331.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  332.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  333.     is32BitCompatible,        /* this app should not be run in 32-bit address space */
  334.     reserved,
  335.     reserved,
  336.     reserved,
  337.     reserved,
  338.     reserved,
  339.     reserved,
  340.     reserved,
  341.     kPrefSize * 1024,
  342.     kMinSize * 1024    
  343. };
  344.  
  345.  
  346.  
  347. resource 'PAT#' (rDitherPatterns, "Dither Patterns") {
  348.     {    /* array PatArray: 65 elements */
  349.         /* [1] */
  350.         $"FFFF FFFF FFFF FFFF",
  351.         /* [2] */
  352.         $"FEFF FFFF FFFF FFFF",
  353.         /* [3] */
  354.         $"FEFF FFFF EFFF FFFF",
  355.         /* [4] */
  356.         $"FEFF FFFF EEFF FFFF",
  357.         /* [5] */
  358.         $"EEFF FFFF EEFF FFFF",
  359.         /* [6] */
  360.         $"EEFF FBFF EEFF FFFF",
  361.         /* [7] */
  362.         $"EEFF FBFF EEFF BFFF",
  363.         /* [8] */
  364.         $"EEFF FBFF EEFF BBFF",
  365.         /* [9] */
  366.         $"EEFF BBFF EEFF BBFF",
  367.         /* [10] */
  368.         $"EEFF BAFF EEFF BBFF",
  369.         /* [11] */
  370.         $"EEFF BAFF EEFF ABFF",
  371.         /* [12] */
  372.         $"EEFF BAFF EEFF AAFF",
  373.         /* [13] */
  374.         $"EEFF AAFF EEFF AAFF",
  375.         /* [14] */
  376.         $"EAFF AAFF EEFF AAFF",
  377.         /* [15] */
  378.         $"EAFF AAFF AEFF AAFF",
  379.         /* [16] */
  380.         $"EAFF AAFF AAFF AAFF",
  381.         /* [17] */
  382.         $"AAFF AAFF AAFF AAFF",
  383.         /* [18] */
  384.         $"AAFD AAFF AAFF AAFF",
  385.         /* [19] */
  386.         $"AAFD AAFF AADF AAFF",
  387.         /* [20] */
  388.         $"AAFD AAFF AADD AAFF",
  389.         /* [21] */
  390.         $"AADD AAFF AADD AAFF",
  391.         /* [22] */
  392.         $"AADD AAF7 AADD AAFF",
  393.         /* [23] */
  394.         $"AADD AAF7 AADD AA7F",
  395.         /* [24] */
  396.         $"AADD AAF7 AADD AA77",
  397.         /* [25] */
  398.         $"AADD AA77 AADD AA77",
  399.         /* [26] */
  400.         $"AADD AA75 AADD AA77",
  401.         /* [27] */
  402.         $"AADD AA75 AADD AA57",
  403.         /* [28] */
  404.         $"AADD AA75 AADD AA55",
  405.         /* [29] */
  406.         $"AADD AA55 AADD AA55",
  407.         /* [30] */
  408.         $"AAD5 AA55 AADD AA55",
  409.         /* [31] */
  410.         $"AAD5 AA55 AA5D AA55",
  411.         /* [32] */
  412.         $"AAD5 AA55 AA55 AA55",
  413.         /* [33] */
  414.         $"AA55 AA55 AA55 AA55",
  415.         /* [34] */
  416.         $"AA54 AA55 AA55 AA55",
  417.         /* [35] */
  418.         $"AA54 AA55 AA45 AA55",
  419.         /* [36] */
  420.         $"AA54 AA55 AA44 AA55",
  421.         /* [37] */
  422.         $"AA44 AA55 AA44 AA55",
  423.         /* [38] */
  424.         $"AA44 AA51 AA44 AA55",
  425.         /* [39] */
  426.         $"AA44 AA51 AA44 AA15",
  427.         /* [40] */
  428.         $"AA44 AA51 AA44 AA11",
  429.         /* [41] */
  430.         $"AA44 AA11 AA44 AA11",
  431.         /* [42] */
  432.         $"AA44 AA10 AA44 AA11",
  433.         /* [43] */
  434.         $"AA44 AA10 AA44 AA01",
  435.         /* [44] */
  436.         $"AA44 AA10 AA44 AA",
  437.         /* [45] */
  438.         $"AA44 AA00 AA44 AA",
  439.         /* [46] */
  440.         $"AA40 AA00 AA44 AA",
  441.         /* [47] */
  442.         $"AA40 AA00 AA04 AA",
  443.         /* [48] */
  444.         $"AA40 AA00 AA00 AA",
  445.         /* [49] */
  446.         $"AA00 AA00 AA00 AA",
  447.         /* [50] */
  448.         $"A800 AA00 AA00 AA",
  449.         /* [51] */
  450.         $"A800 AA00 8A00 AA",
  451.         /* [52] */
  452.         $"A800 AA00 8800 AA",
  453.         /* [53] */
  454.         $"8800 AA00 8800 AA",
  455.         /* [54] */
  456.         $"8800 A200 8800 AA",
  457.         /* [55] */
  458.         $"8800 A200 8800 2A",
  459.         /* [56] */
  460.         $"8800 A200 8800 22",
  461.         /* [57] */
  462.         $"8800 2200 8800 22",
  463.         /* [58] */
  464.         $"8800 2000 8800 22",
  465.         /* [59] */
  466.         $"8800 2000 8800 02",
  467.         /* [60] */
  468.         $"8800 2000 88",
  469.         /* [61] */
  470.         $"8800 0000 88",
  471.         /* [62] */
  472.         $"8000 0000 88",
  473.         /* [63] */
  474.         $"8000 0000 08",
  475.         /* [64] */
  476.         $"80",
  477.         /* [65] */
  478.         $""
  479.     }
  480. };
  481.